import { reloadable } from '@mobilc/vlua-tool';

const heroSelectionTime = 10;

@reloadable
export class GameMode {
    constructor() {
        this.configure();
        ListenToGameEvent('game_rules_state_change', () => this.OnStateChange(), undefined);
        ListenToGameEvent('npc_spawned', (event) => this.OnNpcSpawned(event), undefined);
        CustomGameEventManager.RegisterListener('c2s_test_event', (id, event) => print('你点击了测试按钮'));
    }

    private configure(): void {
        GameRules.SetCustomGameTeamMaxPlayers(DOTATeam_t.DOTA_TEAM_GOODGUYS, 3);
        GameRules.SetCustomGameTeamMaxPlayers(DOTATeam_t.DOTA_TEAM_BADGUYS, 3);

        GameRules.SetShowcaseTime(0);
        GameRules.SetHeroSelectionTime(heroSelectionTime);
    }

    public OnStateChange(): void {}
    public Reload() {
        print('Script reloaded!');
    }

    private OnNpcSpawned(event: NpcSpawnedEvent) {}
}
